<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="button" value="测试01" @click="testfn01">
       <div :style="s"></div>
       <hr/>
       <div :style="'width:'+w+'px;height:200px;background-color:tomato'"></div>
       <hr/>
       <div :style="{width:w+'px',height:h+'px'}" style="background-color: tomato;">
       </div>
       <hr/>
       <div :style="[{width:w+'px'},{height:h+'px'}]" style="background-color: green;">
       </div>
    </div>
</body>

</html>
<script src="./js/vue2.js"></script>
<script>


    let vm = new Vue({
        el: "#app",
        data: {
          s:"width:200px;height:200px;background-color:tomato",
          w:200,
          h:100
        },
        methods:{
            testfn01(){
                this.s = "width:300px;height:200px;background-color:tomato";
                this.w +=20;
                this.h += 30;
            }
        }
    });

</script>